<?php
namespace module\app\validate;

use app\Validate;

/*
 * 用户地址模型.
 */
class Address extends Validate
{
    protected $scene = [
        'save' => ['name', 'mobile', 'dist_id', 'title', 'postcode', 'address', 'memo'],
        'index' => ['page', 'pageSize'],
    ];
    /*
     * @inheritdoc
     */
    protected $rule = [
        'id' => 'require|integer|max:10',
        'name' => 'requireWithout:id|max:40',
        'title' => 'max:10',
        'dist_id' => 'requireWithout:id|integer',
        'mobile' => 'requireWithout:id|integer',
        'address' => 'require|max:60',
        'memo' => 'max:40',
        'postcode' => 'max:6',
        'page' => 'integer|>:0',
        'pageSize' => 'integer|>:0',
    ];
    /*
     * @inheritdoc
     */
    protected $field = [
        'id' => 'ID',
        'name' => '联系人',
        'title' => '标记',
        'dist_id' => '地区',
        'mobile' => '手机号',
        'address' => '详细地址',
        'lat' => '经度',
        'lng' => '维度',
        'memo' => '备注',
        'postcode' => '邮编',
        'page' => '页码',
        'pageSize' => '分页大小',
    ];
}
